import format from '@dfeidao/atom-web/dt/format';
import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import show from '@dfeidao/atom-web/ui/show';
export default async function a001(fd: IFeidaoAiBrowserComponent, risk_no: string, equip_depart_name: string, project_manager: string) {
	// todo
	const cha = fd.data.node.querySelector<HTMLDivElement>('[data-id="Cha"]');
	set_node_cls(cha, "display-n", false);
	show(fd.data.node);
	const res = await nodejs<{ dt: Array<{ risk_no: string; risk_content: string; risk_type: string; project_no: string; project_name: string; create_time: number; risk_status: string; involved_amount: string; memo: string }> }>('risk-control/zj-000004/s001', { risk_no });
	const project_name1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="project_name"]');
	project_name1.textContent = res.dt[0].project_name;
	const project_manager1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="project_manager"]');
	project_manager1.textContent = project_manager;
	const equip_depart_name1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="equip_depart_name"]');
	equip_depart_name1.textContent = equip_depart_name;
	const risk_status1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="risk_status"]');
	if (res.dt[0].risk_status === "1") {
		risk_status1.textContent = "已解决";
	} else {
		risk_status1.textContent = "未解决";
	}
	const risk_type1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="risk_type"]');
	if (res.dt[0].risk_type === "1") {
		risk_type1.textContent = "项目风险";
	}
	if (res.dt[0].risk_type === "2") {
		risk_type1.textContent = "人员风险";
	}
	if (res.dt[0].risk_type === "3") {
		risk_type1.textContent = "交付风险";
	}
	if (res.dt[0].risk_type === "4") {
		risk_type1.textContent = "审计风险";
	}
	if (res.dt[0].risk_type === "") {
		risk_type1.textContent = "";
	}
	const involved_amount1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="involved_amount"]');
	involved_amount1.textContent = res.dt[0].involved_amount;
	const create_time1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="create_time"]');
	const time = format(res.dt[0].create_time, 2);
	create_time1.textContent = time;
	const risk_content1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="risk_content"]');
	risk_content1.textContent = res.dt[0].risk_content;
	const memo1 = fd.data.node.querySelector<HTMLSpanElement>('[data-id="memo"]');
	memo1.textContent = res.dt[0].memo;
}
